import { Plank } from '@/components';
import { OrbitControls, PerspectiveCamera } from '@react-three/drei';
import { Canvas } from '@react-three/fiber';
import { ComponentProps } from 'react';

type PlankProps = ComponentProps<typeof Plank>;

export function PlankViewer(props: { plankProps?: PlankProps }) {
  const { plankProps } = props;

  return (
    <Canvas frameloop="always">
      <PerspectiveCamera
        far={140000}
        near={10}
        makeDefault
        up={[0, 0, 1]}
        position={[1400, -600, 500]}
        rotation={[0, 0, 0]}
      />
      <OrbitControls regress={false} />
      {/* <Plane /> */}
      <axesHelper args={[1000]} />
      <ambientLight position={[200, 200, 1400]} />
      <pointLight position={[600, 200, 1400]} />
      {plankProps && <Plank {...plankProps} />}
    </Canvas>
  );
}
